//
//  InfoEditHeaderView.m
//  QuickCare
//
//  Created by lidabiao on 16/7/15.
//  Copyright © 2016年 lidabiao. All rights reserved.
//

#import "InfoEditHeaderView.h"

@interface InfoEditHeaderView ()

@property (weak, nonatomic) IBOutlet UIButton *UserNameButon;

@property (weak, nonatomic) IBOutlet UIButton *idCardButton;

@property (weak, nonatomic) IBOutlet UIButton *phongNumButton;

@end

@implementation InfoEditHeaderView

+(instancetype)infoEditHeaderView
{
    return [[[NSBundle mainBundle] loadNibNamed:@"InfoEditHeaderView" owner:nil options:nil] lastObject];
}

-(void)setUserInfo:(UserInfo *)userInfo
{
    _userInfo = userInfo;
    
    if (_userInfo)
    {
        if (userInfo.userName)
        {
            [self.UserNameButon setTitle:userInfo.userName forState:UIControlStateNormal];
        }
        else
        {
            [self.UserNameButon setTitle:@"未设置" forState:UIControlStateNormal];
        }
        if (userInfo.idCard)
        {
            [self.idCardButton setTitle:userInfo.idCard forState:UIControlStateNormal];
        }
        else
        {
            [self.idCardButton setTitle:@"未设置" forState:UIControlStateNormal];
        }
        [self.phongNumButton setTitle:userInfo.phoneNum forState:UIControlStateNormal];
    }
}

- (IBAction)userNameButtonClick:(UIButton *)sender
{
    if (self.buttonBlock)
    {
        self.buttonBlock(UserNameStyle, @"用户名", sender.currentTitle);
    }
}

- (IBAction)idCardButtonClick:(UIButton *)sender
{
    if (self.buttonBlock)
    {
        self.buttonBlock(idCardStyle, @"身份证", sender.currentTitle);
    }
}
- (IBAction)phoneNumButtonClick:(id)sender
{
    NSLog(@"%p",__func__);
}

@end
